<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <script>
        var date = new Date();
        // console.log(date.getFullYear());
        // console.log(date.getMonth() + 1); // 注： month 范围是 0 - 11
        // console.log(date.getDate());
        // console.log(date.getHours());
        // console.log(date.getMinutes());
        // console.log(date.getSeconds());

        console.log(date);
        date.setFullYear(2018);
        date.setMonth(1);
        date.setDate(2);
        date.setHours(2);
        date.setMinutes(2);
        date.setSeconds(2);
        console.log(date);
    </script>
</head>
<body>
    
</body>
</html>